package com.home.truc.code.components;

import javax.swing.JPanel;

import java.awt.Frame;
import java.awt.BorderLayout;
import javax.swing.JWindow;

import com.home.Entity.TTGoiMon;
import com.home.truc.code.process.MyTimerHideComponent;

import javax.swing.JLabel;
import javax.swing.SwingConstants;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.Color;
import java.awt.SystemColor;
import javax.swing.border.LineBorder;
import java.awt.Font;
import javax.swing.border.TitledBorder;

public class ThongTinGoiMonComponent extends JWindow {

	private static final long serialVersionUID = 1L;
	private JPanel jContentPane = null;

	private TTGoiMon myValue = null;
	
	/**
	 * @param owner
	 */
	public ThongTinGoiMonComponent(Frame owner) {
		super(owner);
		setAlwaysOnTop(true);
		//setResizable(false);
		initialize();
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setSize(307, 248);
		this.setContentPane(getJContentPane());
		
		this.autoHide = new MyTimerHideComponent(2, this);
	}

	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			jContentPane = new JPanel();
			jContentPane.setBackground(SystemColor.window);
			jContentPane.setBorder(new TitledBorder(null, "", TitledBorder.LEADING, TitledBorder.TOP, null, null));
			jContentPane.setLayout(new BorderLayout());
			jContentPane.addMouseListener(new MouseAdapter() {
				@Override
				public void mouseEntered(MouseEvent arg0) {
					SetSelect_AutoHide(false);
				}
				@Override
				public void mouseExited(MouseEvent e) {
					SetSelect_AutoHide(true);
				}
			});
			
			JLabel lblTngSTin = new JLabel("Thông tin gọi món");
			lblTngSTin.setForeground(Color.BLUE);
			lblTngSTin.setFont(new Font("Tahoma", Font.BOLD, 20));
			lblTngSTin.setBackground(SystemColor.textHighlight);
			lblTngSTin.setHorizontalAlignment(SwingConstants.CENTER);
			jContentPane.add(lblTngSTin, BorderLayout.NORTH);
			
			JPanel panel = new JPanel();
			panel.setBorder(new LineBorder(SystemColor.inactiveCaption));
			panel.setBackground(SystemColor.window);
			jContentPane.add(panel, BorderLayout.SOUTH);
			
			JButton btnInHon = new JButton("In hoá đơn");
			panel.add(btnInHon);
			
			JButton btnTnhTin = new JButton("Tính tiền");
			panel.add(btnTnhTin);
			
			JButton btnng = new JButton("Đóng");
			btnng.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent arg0) {
					Dong();
				}
			});
			panel.add(btnng);
			
			JPanel panel_2 = new JPanel();
			panel_2.setBackground(SystemColor.window);
			panel_2.setBorder(new LineBorder(SystemColor.inactiveCaption));
			jContentPane.add(panel_2, BorderLayout.CENTER);
			panel_2.setLayout(new BorderLayout(0, 0));
			
			JLabel lblTnThiGian = new JLabel("tên, thời gian gọi, thời gian nhận");
			panel_2.add(lblTnThiGian, BorderLayout.NORTH);
			
			JLabel lblTngSTin_1 = new JLabel("tổng số tiền");
			panel_2.add(lblTngSTin_1, BorderLayout.SOUTH);
		}
		return jContentPane;
	}
	////////////////////////////////////////////////////////////////////////////////////////////////////
	MyTimerHideComponent autoHide = null;
	public void SetSelect_AutoHide(boolean b) {
		this.autoHide.SetCanHide(b);
	}
	
	public void Dong()
	{
		this.hide();
	}
}
